package UnOfficeDeTourisme;

/**
 * Interface definition : Carte
 * 
 * @author OpenORB Compiler
 */
public abstract class CartePOA extends org.omg.PortableServer.Servant
        implements CarteOperations, org.omg.CORBA.portable.InvokeHandler
{
    public Carte _this()
    {
        return CarteHelper.narrow(_this_object());
    }

    public Carte _this(org.omg.CORBA.ORB orb)
    {
        return CarteHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:UnOfficeDeTourisme/Carte:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    private static final java.util.Map operationMap = new java.util.HashMap();

    static {
            operationMap.put("_get_dateValidite",
                    new Operation__get_dateValidite());
            operationMap.put("_get_idCarte",
                    new Operation__get_idCarte());
            operationMap.put("_get_listeDesEntrees",
                    new Operation__get_listeDesEntrees());
            operationMap.put("ajouterEntree",
                    new Operation_ajouterEntree());
            operationMap.put("ajouterPresta",
                    new Operation_ajouterPresta());
            operationMap.put("calculerPrixTotalAPayer",
                    new Operation_calculerPrixTotalAPayer());
            operationMap.put("dejaVisite",
                    new Operation_dejaVisite());
            operationMap.put("getAllEntrees",
                    new Operation_getAllEntrees());
            operationMap.put("getEntrees",
                    new Operation_getEntrees());
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        final AbstractOperation operation = (AbstractOperation)operationMap.get(opName);

        if (null == operation) {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }

        return operation.invoke(this, _is, handler);
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_idCarte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg = idCarte();
        _output = handler.createReply();
        _output.write_long(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__get_dateValidite(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.datecut arg = dateValidite();
        _output = handler.createReply();
        UnOfficeDeTourisme.datecutHelper.write(_output,arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__get_listeDesEntrees(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Entree[] arg = listeDesEntrees();
        _output = handler.createReply();
        UnOfficeDeTourisme.listeEntreesHelper.write(_output,arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getEntrees(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        try
        {
            UnOfficeDeTourisme.Entree[] _arg_result = getEntrees(arg0_in);

            _output = handler.createReply();
            UnOfficeDeTourisme.listeEntreesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getAllEntrees(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;

        try
        {
            UnOfficeDeTourisme.Entree[] _arg_result = getAllEntrees();

            _output = handler.createReply();
            UnOfficeDeTourisme.listeEntreesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_ajouterEntree(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.genericEntry[] arg0_in = UnOfficeDeTourisme.hashMapObectId_IORHelper.read(_is);

        try
        {
            ajouterEntree(arg0_in);

            _output = handler.createReply();

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_ajouterPresta(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Prestation arg0_in = UnOfficeDeTourisme.PrestationHelper.read(_is);

        ajouterPresta(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_calculerPrixTotalAPayer(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;

        try
        {
            float _arg_result = calculerPrixTotalAPayer();

            _output = handler.createReply();
            _output.write_float(_arg_result);

        }
        catch (UnOfficeDeTourisme.MontantNegatifException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.MontantNegatifExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_dejaVisite(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Visite arg0_in = UnOfficeDeTourisme.VisiteHelper.read(_is);

        boolean _arg_result = dejaVisite(arg0_in);

        _output = handler.createReply();
        _output.write_boolean(_arg_result);

        return _output;
    }

    // operation classes
    private abstract static class AbstractOperation {
        protected abstract org.omg.CORBA.portable.OutputStream invoke(
                CartePOA target,
                org.omg.CORBA.portable.InputStream _is,
                org.omg.CORBA.portable.ResponseHandler handler);
    }

    private static final class Operation__get_idCarte extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke__get_idCarte(_is, handler);
        }
    }

    private static final class Operation__get_dateValidite extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke__get_dateValidite(_is, handler);
        }
    }

    private static final class Operation__get_listeDesEntrees extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke__get_listeDesEntrees(_is, handler);
        }
    }

    private static final class Operation_getEntrees extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_getEntrees(_is, handler);
        }
    }

    private static final class Operation_getAllEntrees extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_getAllEntrees(_is, handler);
        }
    }

    private static final class Operation_ajouterEntree extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_ajouterEntree(_is, handler);
        }
    }

    private static final class Operation_ajouterPresta extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_ajouterPresta(_is, handler);
        }
    }

    private static final class Operation_calculerPrixTotalAPayer extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_calculerPrixTotalAPayer(_is, handler);
        }
    }

    private static final class Operation_dejaVisite extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final CartePOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_dejaVisite(_is, handler);
        }
    }

}
